import { useSearchParams } from "react-router-dom";
import './index.css'

const Article = () => {
    const [params] = useSearchParams()
    const id = params.get('id')
    const userName = params.get('name')
    return (
        <>
            {params.size > 0 && 
            <div className="header">
                <p>Welcome, {userName}, id is {id}.</p>
            </div>
            }
            <div>I am Article.</div>
        </>
    )
}

export default Article;
/**
 * useSearchParams 传参
 */